<template>
	<view class="container">
		<view class="main-container" v-if="content">
			<view v-html="content" class="con"></view>
		</view>
	</view>
</template>

<script>
import { onPrivacyPolicy, getuserRule } from '@/api/account/account.js';
export default {
	data() {
		return {
			content: '',
			name: ''
		};
	},
	onLoad(option) {
		this.name = option.name;
		if (this.name == 1) {
			this.getPrivacyPolicy();
		} else {
			this.userRule();
		}
	},
	// created() {
	// 	this.getPrivacyPolicy();
	// 	this.userRule();
	// },
	methods: {
		async getPrivacyPolicy() {
			const data = await onPrivacyPolicy();
			// console.log(data,"res")
			if (data.code === 200) {
				for (let i = 0; i < data.data.length; i++) {
					this.content = this.content.concat(data.data[i].content);
				}
			} else if (data.code === 101) {
				this.content = '';
			} else {
				this.$modal.msgError(data.msg);
			}
		},
		async userRule() {
			const data = await getuserRule();
			console.log(data);
			if (data.code === 200) {
				for (let i = 0; i < data.data.length; i++) {
					this.content = this.content.concat(data.data[i].content);
				}
			} else if (data.code === 101) {
				this.content = '';
			} else {
				this.$modal.msgError(data.msg);
			}
		}
	}
};
</script>
<style lang="scss" scoped>
.main-container {
	color: #fff;
	height: 100%;
	padding: 0 30rpx;
}
</style>
